<template>
  <a-card :bordered="false">
	  <!-- 操作按钮区域 -->
	  <div class="table-operator">
	    <a-button type="primary" icon="plus" @click="handleAdd()">新增</a-button>
	  </div>
    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
		 @change="handleTableChange">
		<span slot="type" slot-scope="text, record">
		   {{text == 1 ? '宝妈' : '月嫂'}}
		</span>
        <span slot="bannerUrl" slot-scope="text, record">
		   <img :src="record.bannerUrl" alt="avatar" style="width:694px;height:320px;object-fit: cover;" />
		</span>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>

          <a-divider type="vertical" />
		  <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
		    <a>删除</a>
		  </a-popconfirm>
        </span>

      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <wechatBanner-modal ref="modalForm" @ok="modalFormOk"></wechatBanner-modal>
  </a-card>
</template>

<script>
  import '@/assets/less/TableExpand.less'
  import WechatBannerModal from './modules/WechatBannerModal'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'

  export default {
    name: "WechatBannerList",
    mixins:[JeecgListMixin],
    components: {
      WechatBannerModal
    },
    data () {
      return {
        description: '小程序banner管理页面',
        // 表头
        columns: [
          {
            title: '序号',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
           },
		   {
		    title: '背景图',
		    align:"center",
		    dataIndex: 'type',
		   	scopedSlots: { customRender: 'type' },
		   },
		   {
            title: '背景图',
            align:"center",
            dataIndex: 'bannerUrl',
			scopedSlots: { customRender: 'bannerUrl' },
           },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            scopedSlots: { customRender: 'action' },
          }
        ],
		url: {
          list: "/wechat/wechatBanner/list",
          delete: "/wechat/wechatBanner/delete",
          deleteBatch: "/wechat/wechatBanner/deleteBatch",
          exportXlsUrl: "wechat/wechatBanner/exportXls",
          importExcelUrl: "wechat/wechatBanner/importExcel",
       },
    }
  },
  computed: {
    importExcelUrl: function(){
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    }
  },
    methods: {
     
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>